Memory leak - stringOf (Filter)

I have an attribute DXL script which is causing a memory leak. The script interrogates a large compound filter (maybe 100+ rules) which causes a memory leak when scrolling through any module view displaying the attribute (due to repeated interrogation of the filter description for each newly displayed object).
The size of the memory leak appears to increase with the size of the filter definition suggesting the stringOf filter function is leaking.
Below is some sample code to demonstrate the effect, note the larger the current filter the larger the leak.
 

Module mCur = current
Filter fCur = current Filter
string strFilter = ""
 
if (!null fCur)
{
    strFilter = stringOf (mCur, fCur)
}
 
// code to process strFilter
 
obj.attrDXLName = richText strFilter


Any ideas how to fix this memory leak?

 

 


Martin Hunter

 

 


Martin_Hunter - Tue Oct 16 05:38:19 EDT 2012

Re: Memory leak - stringOf (Filter)
OurGuest - Tue Oct 16 10:00:12 EDT 2012

Try:

Module mCur = current
Filter fCur = current Filter
if (null fCur)obj.attrDXLName=" "
obj.attrDXLName = richText( stringOf (mCur, fCur))

Re: Memory leak - stringOf (Filter)
OurGuest - Tue Oct 16 10:01:39 EDT 2012

OurGuest - Tue Oct 16 10:00:12 EDT 2012

Try:

Module mCur = current
Filter fCur = current Filter
if (null fCur)obj.attrDXLName=" "
obj.attrDXLName = richText( stringOf (mCur, fCur))

Oops forgot else:

{code}
Module mCur = current
Filter fCur = current Filter
if (null fCur)obj.attrDXLName=" "
else obj.attrDXLName = richText( stringOf (mCur, fCur))
{code

Re: Memory leak - stringOf (Filter)
llandale - Tue Oct 16 13:51:10 EDT 2012

Let me violate natural Attr-DXL context guidelines:

Module mCur = module(obj)
current = mCurr
Filter fCur = current Filter
string strFilter = ""
 
if (!null fCur) //
then strFilter = stringOf (mCur, fCur)
else strFilter = "no filter"
 
 
Object o
for o in entire(mCur) do
{  if (isVisible(o)   or
       obj == o) o.attrDXLName = strFilter  // or richText(strFilter) if you prefer
}


Thus you use the memory leak part only once.

-Louie

Not sure why you want an attr-DXL that has the same value for all objects.

Re: Memory leak - stringOf (Filter)
Martin_Hunter - Wed Oct 17 01:31:53 EDT 2012

llandale - Tue Oct 16 13:51:10 EDT 2012

Let me violate natural Attr-DXL context guidelines:

Module mCur = module(obj)
current = mCurr
Filter fCur = current Filter
string strFilter = ""
 
if (!null fCur) //
then strFilter = stringOf (mCur, fCur)
else strFilter = "no filter"
 
 
Object o
for o in entire(mCur) do
{  if (isVisible(o)   or
       obj == o) o.attrDXLName = strFilter  // or richText(strFilter) if you prefer
}


Thus you use the memory leak part only once.

-Louie

Not sure why you want an attr-DXL that has the same value for all objects.

Guys,

Thanks for your help and ideas. I was trying Louie's idea, then tried replacing strFilter with stringOf (current Module, current Filter) wherever used in the code and the leak has been plugged.

Sample code was simple to demonstrate memory leak.

Martin Hunter

Re: Memory leak - stringOf (Filter)
llandale - Wed Oct 17 10:38:12 EDT 2012

Martin_Hunter - Wed Oct 17 01:31:53 EDT 2012
Guys,

Thanks for your help and ideas. I was trying Louie's idea, then tried replacing strFilter with stringOf (current Module, current Filter) wherever used in the code and the leak has been plugged.

Sample code was simple to demonstrate memory leak.

Martin Hunter

So your original code had the leak? please post the code that doesn't.